package com.sugou.system.var;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public class GlobalVars {
	private GlobalVars(){}
	private static ThreadLocal<Map<String, Object>> vars=new ThreadLocal<Map<String,Object>>(){
		protected Map<String, Object> initialValue() {
			return new HashMap<String, Object>();
		}
	};
	
	public static void setVar(String name,Object var){
		vars.get().put(name, var);
	}
	
	public static Object getVar(String name){
		return vars.get().get(name);
	}
	
	public static void clear(){
		vars.get().clear();
		vars.remove();
	}
}
